package com.admin.dao.booktypedao;


import com.pojo.BookTypeBean;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class BookTypeDaoImpl implements BookTypeDaoInF {
    @Override
    public boolean InsertInfo(String sql, Connection conn, BookTypeBean bookTypeBean) throws SQLException {

        boolean bool = false;
        PreparedStatement pstm = null;
        ResultSet resultSet = null;

        try {
            pstm = conn.prepareStatement(sql);
            pstm.setString(1, bookTypeBean.getTypeName());
            pstm.setString(2, bookTypeBean.getTypeAddress());

            int len = pstm.executeUpdate();
//            System.out.println("插入结果" + len);
            if (len > 0) {
                bool = true;
            }
        } finally {
            if (pstm != null) {
                pstm.close();
            }
            if (resultSet != null) {
                resultSet.close();
            }
        }
        return bool;
    }


//    @Override
//    public int insert(BookTypeBean bookTypeBean) throws SQLException {
//        String sql="INSERT into booktype VALUES(null,?,?)";
//
//    }

}
